<%@tag pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="consignum" tagdir="/WEB-INF/tags"%>
<%@attribute name="id"%>
<%@attribute name="label" required="true"%>
<%@attribute name="styleClass"%>
<%@attribute name="styleClassSection" type="java.lang.String"%>
<%@attribute name="styleRow" type="java.lang.String"%>
<%@attribute name="style"%>
<%@attribute name="noSelecion"%>
<%@attribute name="hint"%>
<%@attribute name="identifierMessage" type="java.lang.String"%>
<%@attribute name="tooltip"%>
<%@attribute name="execute"%>
<%@attribute name="action"%>
<%@attribute name="update"%>
<%@attribute name="render"%>
<%@attribute name="var" required="true"%>
<%@attribute name="value" type="java.lang.Object" required="true"%>
<%@attribute name="valueSelect" type="java.lang.Object" required="true"%>
<c:set scope="request" var="identifier" value="${identifierMessage}" />
<c:if test="${not empty requestScope.validacao.erros[identifier]}" var="contemErrosDeValidacao">
   <div class="row" style="${styleRow}">
	<section style="${styleRow}"  <consignum:renderedField field="class" value="${styleClassSection}" defaultValue="col col-6" />>
	    <label class="labelConsignum">
		  <c:out value="${label}" default=" " />
		</label>

        <label class="select state-error">
			<select
			     <c:if test="${not empty action and empty render}">
			         onchange="javascript: submitAjax('${execute}','${action}','${update}');"
			     </c:if>
			     <c:if test="${not empty render}">
			         onchange="javascript: submitAjaxPartial('${execute}','${action}','${render}');"
			     </c:if>
			     
			   	 <consignum:renderedField field="id" value="${id}" />
			     <consignum:renderedField field="name" value="${id}" />
			     <consignum:renderedField field="class" value="${styleClass}" />
			     <consignum:renderedField field="style" value="${style}" defaultValue="border-radius: 4px;"/> 
			    >
			     
				<option value=""><c:out value="${noSelecion}" default="Selecione..." /></option>
				
				<c:forEach var="var" items="${value}">
					<option value="${var.value}" <c:if test="${not empty valueSelect and valueSelect eq var.value}">selected="selected"</c:if>><c:out value="${var.name}" /></option>
				</c:forEach>
			</select><i></i>
		</label>
		<div class="note note-error" style="width:600px;">
			<label class="labelConsignumMessage"><c:out value="${requestScope.validacao.erros[identifier]}" default=" " /></label>
		</div>
	</section>
	</div>
</c:if>
<c:if test="${not contemErrosDeValidacao}">
	<div class="row"  style="${styleRow}">
	<section  style="${styleRow}"   <consignum:renderedField field="class" value="${styleClassSection}" defaultValue="col col-6" />>
		 <label class="labelConsignum"> <c:out value="${label}" default=" " /></label> 
		<label class="select"> 
			<select 
				 <c:if test="${not empty action and empty render}">
			         onchange="javascript: submitAjax('${execute}','${action}','${update}');"
			     </c:if>
			     <c:if test="${not empty render}">
			         onchange="javascript: submitAjaxPartial('${execute}','${action}','${render}');"
			     </c:if>
			     
			   	 <consignum:renderedField field="id" value="${id}" />
			     <consignum:renderedField field="name" value="${id}" />
			     <consignum:renderedField field="class" value="${styleClass}" />
			     <consignum:renderedField field="style" value="${style}" defaultValue="border-radius: 4px;"/> 
			    >
			     
				<option value=""><c:out value="${noSelecion}" default="Selecione..." /></option>
				
				<c:forEach var="var" items="${value}">
					<option value="${var.value}" <c:if test="${not empty valueSelect and valueSelect eq var.value}">selected="selected"</c:if>><c:out value="${var.name}" /></option>
				</c:forEach>
			</select><i></i>
		</label>
	</section>
	</div>
	
</c:if>